﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;

namespace LuoYi.Admin.Entities;

/// <summary>
/// 操作日志记录
/// </summary>
[Table("sys_oper_log")]
[Index("BusinessType", Name = "idx_sys_oper_log_bt")]
[Index("OperTime", Name = "idx_sys_oper_log_ot")]
[Index("Status", Name = "idx_sys_oper_log_s")]
public class SysOperLog : IEntity
{
    /// <summary>
    /// 日志主键
    /// </summary>
    [Key]
    [Column("oper_id", TypeName = "bigint(20)")]
    public long OperId { get; set; }

    /// <summary>
    /// 模块标题
    /// </summary>
    [Column("title")]
    [StringLength(50)]
    public string? Title { get; set; }

    /// <summary>
    /// 业务类型（0其它 1新增 2修改 3删除）
    /// </summary>
    [Column("business_type", TypeName = "int(2)")]
    public int? BusinessType { get; set; }

    /// <summary>
    /// 方法名称
    /// </summary>
    [Column("method")]
    [StringLength(200)]
    public string? Method { get; set; }

    /// <summary>
    /// 请求方式
    /// </summary>
    [Column("request_method")]
    [StringLength(10)]
    public string? RequestMethod { get; set; }

    /// <summary>
    /// 操作类别（0其它 1后台用户 2手机端用户）
    /// </summary>
    [Column("operator_type", TypeName = "int(1)")]
    public int? OperatorType { get; set; }

    /// <summary>
    /// 操作人员
    /// </summary>
    [Column("oper_name")]
    [StringLength(50)]
    public string? OperName { get; set; }

    /// <summary>
    /// 部门名称
    /// </summary>
    [Column("dept_name")]
    [StringLength(50)]
    public string? DeptName { get; set; }

    /// <summary>
    /// 请求URL
    /// </summary>
    [Column("oper_url")]
    [StringLength(255)]
    public string? OperUrl { get; set; }

    /// <summary>
    /// 主机地址
    /// </summary>
    [Column("oper_ip")]
    [StringLength(128)]
    public string? OperIp { get; set; }

    /// <summary>
    /// 操作地点
    /// </summary>
    [Column("oper_location")]
    [StringLength(255)]
    public string? OperLocation { get; set; }

    /// <summary>
    /// 请求参数
    /// </summary>
    [Column("oper_param")]
    [StringLength(2000)]
    public string? OperParam { get; set; }

    /// <summary>
    /// 返回参数
    /// </summary>
    [Column("json_result")]
    [StringLength(2000)]
    public string? JsonResult { get; set; }

    /// <summary>
    /// 操作状态（0正常 1异常）
    /// </summary>
    [Column("status", TypeName = "int(1)")]
    public int? Status { get; set; }

    /// <summary>
    /// 错误消息
    /// </summary>
    [Column("error_msg")]
    [StringLength(2000)]
    public string? ErrorMsg { get; set; }

    /// <summary>
    /// 操作时间
    /// </summary>
    [Column("oper_time", TypeName = "datetime")]
    public DateTime? OperTime { get; set; }

    /// <summary>
    /// 消耗时间
    /// </summary>
    [Column("cost_time", TypeName = "bigint(20)")]
    public long? CostTime { get; set; }
}
